<?php

require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'DAO' . DIRECTORY_SEPARATOR . 'MyPDO.php';

class Transaction {

    private $inTransaction;
    private $mySQLConnection;

    public function __construct()
    {
        $this->inTransaction = false;
    }

    public function inTransaction()
    {
        return $this->inTransaction;
    }

    public function startTransaction($dbName = NULL)
    {
        if (is_null($this->mySQLConnection))
            $this->mySQLConnection = MyPDO::getInstance($dbName);
        $this->inTransaction = true;
    }

    public function closeTransaction()
    {
        if ($this->inTransaction) {
            if (!is_null($this->mySQLConnection))
                $this->mySQLConnection = null;
        }
        $this->inTransaction = false;
    }

    public function getMySQLConnection()
    {
        return $this->mySQLConnection;
    }

    public function rollback(){
    }

    public function comit(){
    }
}
?>